﻿using System;
using System.ComponentModel;
using System.Windows.Forms;
using Assist;
using Autodesk.Revit.UI;
using YJKRevitKernel.FormUtility.ModelessFormControlSuite.ModelLayer;

namespace YJKRevitKernel.FormUtility.ModelessFormControlSuite.ViewLayer
{
	public partial class BaseNoneSwitchForm : Form, IModelessFormNoneSwitch
	{
		public BaseNoneSwitchForm(UIDocument inputDoc, IWin32Window input)
		{
			this.m_useUiDocument = inputDoc;
			this.m_RevitHandle = input;
			this.InitializeComponent();
		}

		protected void SendContinueMessage()
		{
			this.m_bIfContinueTag = true;
			this.m_bIfBreakTag = false;
			this.m_bIfManualEsc = false;
			this.SendEscMessageToRevitAndClearSelect();
		}

		protected void SendBreakMessage()
		{
			this.m_bIfContinueTag = false;
			this.m_bIfBreakTag = true;
			this.m_bIfManualEsc = false;
			this.SendEscMessageToRevitAndClearSelect();
		}

		public bool IfBreak
		{
			get
			{
				return this.m_bIfBreakTag;
			}
		}

		public bool IfContinue
		{
			get
			{
				return this.m_bIfContinueTag;
			}
		}

		public bool IfManualEsc
		{
			get
			{
				return this.m_bIfManualEsc;
			}
		}

		public void CloseForm()
		{
			if (!base.IsDisposed)
			{
				this.m_bDontSendEscTag = true;
				base.Close();
			}
		}

		public void ResetContinueBreak()
		{
			this.m_bIfContinueTag = false;
			this.m_bIfBreakTag = true;
			this.m_bIfManualEsc = true;
		}

		public void SendEscMessageToRevitAndClearSelect()
		{
			RevitVersionFuncs.ClearSelection(this.m_useUiDocument.Selection);
			if (this.m_RevitHandle != null)
			{
				Utility.SendEscToHandle(this.m_RevitHandle);
			}
		}

		public void ShowForm(IWin32Window parentForm = null)
		{
			if (parentForm != null)
			{
				base.Show(parentForm);
				return;
			}
			base.Show();
		}

		protected UIDocument m_useUiDocument;

		protected IWin32Window m_RevitHandle;

		protected bool m_bIfContinueTag;

		protected bool m_bIfBreakTag = true;

		protected bool m_bIfManualEsc = true;
	}
}
